package com.hzya.frame.utils.core.tree;


public class SubTree
{
  private String root;
  private String rootname;
  private String rootid;
  private String branchurl;
  private String leafurl;
  private String imptree = Constants.IMP_TREE_CLASS;

  public String getTreeJs(String contextPath)
  {
    Constants.ROOT = contextPath;
    Constants.PIC_CLOSE = Constants.SERVLET + "?act=close";
    Constants.PIC_OPEN = Constants.SERVLET + "?act=open";
    Constants.PIC_FLUSH = Constants.SERVLET + "?act=flush";
    Constants.PIC_DOCS = Constants.SERVLET + "?act=docs";
    Constants.SUBTREE = Constants.SERVLET + "?act=sub";
    Constants.PIC_OPEN_ = Constants.SERVLET + "?act=open_";
    Constants.PIC_OPEND = Constants.SERVLET + "?act=opend";
    Constants.PIC_CLOSE_ = Constants.SERVLET + "?act=close_";
    Constants.PIC_CLOSED = Constants.SERVLET + "?act=closed";
    if ((getBranchurl() != null) && (getBranchurl().indexOf("${base}") != -1))
      setBranchurl(getBranchurl().replaceAll("\\$\\{base\\}", contextPath));

    if ((getLeafurl() != null) && (getLeafurl().indexOf("${base}") != -1))
      setLeafurl(getLeafurl().replaceAll("\\$\\{base\\}", contextPath));

    Constants.BRANCHURL = this.branchurl;
    Constants.LEAFURL = this.leafurl;
    Constants.IMP_TREE_CLASS = this.imptree;
    StringBuffer sb = new StringBuffer();
    sb.append("<script>\r\n<!--\r\n");
    sb.append(Constants.getTreeJS());
    sb.append("\r\n tree.outPutRoot('" + this.rootid + "','" + this.rootname + "');");
    sb.append("\r\n //-->\r\n</script>");
    return sb.toString();
  }

  public String getRoot() {
    return this.root;
  }

  public void setRoot(String root) {
    this.root = root;
  }

  public String getRootname() {
    return this.rootname;
  }

  public void setRootname(String rootname) {
    this.rootname = rootname;
  }

  public String getRootid() {
    return this.rootid;
  }

  public void setRootid(String rootid) {
    this.rootid = rootid;
  }

  public String getBranchurl() {
    return this.branchurl;
  }

  public void setBranchurl(String branchurl) {
    this.branchurl = branchurl;
  }

  public String getLeafurl() {
    return this.leafurl;
  }

  public void setLeafurl(String leafurl) {
    this.leafurl = leafurl;
  }

  public String getImptree() {
    return this.imptree;
  }

  public void setImptree(String imptree) {
    this.imptree = imptree;
  }
}